package pub.guoxin.oops.manager.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pub.guoxin.oops.constants.OopsPathConstants;
import pub.guoxin.oops.manager.handler.AlarmFieldNameConstants;
import pub.guoxin.oops.vo.ResultVo;
import pub.guoxin.oops.vo.ResultVoBuilder;

/**
 * Create by guoxin on 2018/5/5
 */
@RestController
@RequestMapping(OopsPathConstants.ALARM_PATH)
public class AlarmController {

    @Autowired
    private ResultVoBuilder builder;

    @PreAuthorize(value = "hasAnyRole('ADMIN, USER')")
    @ApiOperation(value = "预警字段", notes = "注册通讯模块（权限：公司管理员）")
    @PostMapping(value = "/field-name", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultVo fieldName() {
        return builder.buildSuccessResultInfo(AlarmFieldNameConstants.FIELD_NAME_MAP);
    }

}
